//
//  LoginController.m
//  oc1
//
//  Created by kokuma on 2017/2/15.
//  Copyright © 2017年 kokumams. All rights reserved.
//

#import "LoginController.h"
#import "NSObject+Common.h"
#import "UIButton+Bootstrap.h"


@implementation LoginController

- (void)viewDidLoad {
     [super viewDidLoad];
    [super didReceiveMemoryWarning];
    [self.view addSubview:self.mobileInputView];
    [self.view addSubview:self.loginPwdInputView];
    [self.view addSubview:self.completeBtn];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (UILabel *) mobileInputView{
    UITextField *txtView = [UITextField alloc];
    [txtView initWithFrame:CGRectMake(60, 80, 200, 50)];
    txtView.backgroundColor = [UIColor blueColor];
    [txtView setFont:[UIFont systemFontOfSize:17]];
    [txtView addTarget:self action:@selector(editDidBegin:) forControlEvents:UIControlEventEditingDidBegin];
    [txtView addTarget:self action:@selector(textValueChanged:) forControlEvents:UIControlEventEditingChanged];
    [txtView addTarget:self action:@selector(editDidEnd:) forControlEvents:UIControlEventEditingDidEnd];
    return txtView;
}

- (UILabel *) loginPwdInputView{
    UITextField *txtView = [UITextField alloc];
    [txtView initWithFrame:CGRectMake(60, 150, 200, 50)];
    txtView.backgroundColor = [UIColor blueColor];
    [txtView setFont:[UIFont systemFontOfSize:17]];
    [txtView addTarget:self action:@selector(editDidBegin:) forControlEvents:UIControlEventEditingDidBegin];
    [txtView addTarget:self action:@selector(textValueChanged:) forControlEvents:UIControlEventEditingChanged];
    [txtView addTarget:self action:@selector(editDidEnd:) forControlEvents:UIControlEventEditingDidEnd];
    txtView.secureTextEntry = YES;
    return txtView;
}

- (UIView *)completeBtn{
    UIButton *btn = [UIButton buttonWithStyle:StrapSuccessStyle andTitle:@"点我登录" andFrame:CGRectMake(60, 220, 120, 50) target:self action:@selector(login)];
     return btn;
}

- (void) login{
    [NSObject showHudTipStr:@"登陆去了"];
}

- (void) editDidBegin:(id)sender{
    [NSObject showHudTipStr:@"开始编辑了"];
}

- (void) textValueChanged:(id)sender{
    //
}

- (void) editDidEnd:(id)sender{
    [NSObject showHudTipStr:@"要结束编辑了"];
}
@end
